
function selectMerchandise(){
	var merchandise_name = escape(escape(document.getElementById('merchandise_name').value));
	var parent_type = escape(escape(document.getElementById('parent_type').value));
	var merchandise_type = escape(escape(document.getElementById('merchandise_type').value));
	
	var url = '/storage/manager/pages/merchandise.do?method=selectMerchandise&d=' + new Date();
	url = url + '&merchandise_name=' + merchandise_name;
	url = url + '&parent_type=' + parent_type;
	url = url + '&merchandise_type=' + merchandise_type;
	
	$.getJSON(url, {}, function(data){
		$('#merchandise_list').html('');
		var _max = get_max_line(470,25);
		for(var i=0;i<data.length;i++){
			var style_border = 0-(0-i-1)==data.length&&data.length>=_max?'style="border-bottom:0;"':'';
			var merchandiseList = '';
			merchandiseList = merchandiseList + '<tr style="height:25px;" onmouseover="cbgcolor(this,0)" onmouseout="cbgcolor(this,1)">';
			merchandiseList = merchandiseList + '  <td class="list" '+style_border+' width="18" ><input type="checkbox" name="selected_items" value="'+data[i][0]+'" /></td>';
			merchandiseList = merchandiseList + '  <td class="list" '+style_border+' width="130" >'+data[i][1]+'</td>';
			merchandiseList = merchandiseList + '  <td class="list" '+style_border+' width="" >'+data[i][2]+'</td>';
			merchandiseList = merchandiseList + '  <td class="list" '+style_border+' width="90" >'+data[i][3]+'</td>';
			merchandiseList = merchandiseList + '  <td class="list" '+style_border+' width="130" >'+data[i][4]+'</td>';
			merchandiseList = merchandiseList + '  <td class="list" '+style_border+' width="100" >'+data[i][5]+'</td>';
			merchandiseList = merchandiseList + '  <td class="list" '+style_border+' width="45" >'+data[i][6]+'</td>';
			merchandiseList = merchandiseList + '</tr>';
			$('#merchandise_list').append(merchandiseList);
		}
		if(data.length<_max){
			add_foot();
		}
	});
};
function add_foot(){
	var foot = '';
    foot = foot + '<tr>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="18" >&nbsp;</td>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="130" >&nbsp;</td>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="" >&nbsp;</td>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="90" >&nbsp;</td>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="130" >&nbsp;</td>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="100" >&nbsp;</td>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="45" >&nbsp;</td>';
	foot = foot + '</tr>';
	$('#merchandise_list').append(foot);
};